package com.ctg.payroll2.dao.empadmin.Impl;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import com.ctg.payroll2.bean.filter.empadmin.CsEmpDimissionFilter;
import com.ctg.payroll2.bean.po.CsEmpDimission;
import com.ctg.payroll2.dao.empadmin.CsEmpDimissionDao;
import com.ctg.platform.orm.ibatis.IbatisEntityDao;
import com.ctg.platform.util.Page;

public class CsEmpDimissionDaoImp extends IbatisEntityDao implements
		CsEmpDimissionDao {
	private String getNameSpace(){
		return this.getClass().getSimpleName();
	}
	
	public Page queryEmpDimissionPageByFilter(CsEmpDimissionFilter filter){
		return pagedQueryByFilter(this.getClass(), filter,
				".queryEmpDimissionPageByFilter_count",
				".queryEmpDimissionPageByFilter_query");
	}
	
	public void insertEmpDimission(CsEmpDimission csEmpDimission) throws SQLException{
		getSqlMapClient().insert(getNameSpace() + ".insertEmpDimission", csEmpDimission);
	}
	
	public void updateEmpDimission(CsEmpDimission csEmpDimission) throws SQLException{
		getSqlMapClient().insert(getNameSpace() + ".updateEmpDimission", csEmpDimission);
	}
	
	public void updateEmployee(CsEmpDimission csEmpDimission) throws SQLException{
		getSqlMapClient().update(getNameSpace() + ".updateEmployee", csEmpDimission);
	}

	public int deleteEmpDimission(String ids) throws SQLException {
		return getSqlMapClient().delete(getNameSpace() + ".deleteEmpDimission", ids);
	}
	
	public List queryById(Long id) throws SQLException{
		return getSqlMapClient().queryForList(getNameSpace()+".selectById",id);
	}
	
	public void updateStatusById(CsEmpDimission csEmpDimission,Map<String, Object> map) throws SQLException{
		getSqlMapClient().update(getNameSpace() + ".updateEmployeeByStatus", csEmpDimission);
		getSqlMapClient().update(getNameSpace() + ".updateStatus", map);
	}
}
